package com.wsg.lightaccounting.Activity;

import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.wsg.lightaccounting.Model.CreditCard;
import com.wsg.lightaccounting.R;

public class ChoiceAccountActivity extends AppCompatActivity implements View.OnClickListener{
    private ImageView back;
    private LinearLayout cash_crad,credit_crad,network_payment,customzed;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choice_account);
        initView();
    }
    private void initView(){
        back = (ImageView) findViewById(R.id.choice_back);
        cash_crad = (LinearLayout) findViewById(R.id.cash_card_choice_account);
        credit_crad = (LinearLayout) findViewById(R.id.credit_card_choice_account);
        network_payment = (LinearLayout) findViewById(R.id.network_payment_choice_account);
        customzed = (LinearLayout) findViewById(R.id.customized__choice_account);

        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ChoiceAccountActivity.this.finish();
            }
        });
        cash_crad.setOnClickListener(this);
        credit_crad.setOnClickListener(this);
        network_payment.setOnClickListener(this);
        customzed.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.cash_card_choice_account:
                goEditActivity(CashCardActivity.class);
                break;
            case R.id.credit_card_choice_account:
                goEditActivity(CreditCardActivity.class);
                break;
            case R.id.network_payment_choice_account:
                goEditActivity(NetworkPaymentActivity.class);
                break;
            case R.id.customized__choice_account:
                goEditActivity(CustomzedActivity.class);
                break;
            default:
                break;
        }
    }

    private void goEditActivity(Class<?> cls){
        Intent intent = new Intent(this,cls);
        Bundle bundle=new Bundle();
        bundle.putBoolean("isEdit", false);
        intent.putExtras(bundle);
        startActivity(intent);
        finish();
    }
}
